package com.windoent.yugioh.http;

import com.windoent.yugioh.constants.Constants;
import com.windoent.yugioh.help.zhyarray.OkHttpUtilsByArray;
import com.windoent.yugioh.utils.BaseMethod;
import com.zhy.http.okhttp.OkHttpUtils;
import com.zhy.http.okhttp.callback.StringCallback;

import org.json.JSONException;
import org.json.JSONObject;

import java.util.Map;

import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.RequestBody;

/**
 * author : robert
 * date   : 2021/4/29 15:54
 * desc   :接口
 */
public class PhoneLive {
    //微信验证
    public static void verifyWeixin(String code, String mode, String phone, String appid, String user_id, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/platform/login/wx")
                .addParams("code", code)//微信授权码
                .addParams("mode", mode)//第几次授权，第一次授权检查，第二次生成用户信息
                .addParams("phone", phone)//手机号码，第一次授权可不填，第二次验证完手机必填项
                .addParams("appid", appid)//1:IOS 2:Android 3:Applets
                .addParams("user_id", user_id)//mode为1时不需要传值，值为第一次返回得user_id
                .tag("verifyWeixin")
                .build()
                .execute(callback);
    }

    //QQ验证第1次
    public static void verifyQQOne(String open_id, String appid, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/platform/login/qq")
                .addParams("open_id", open_id)
                .addParams("mode", "1")
                .addParams("appid", appid)//1:IOS 2:Android 3:Applets
                .tag("verifyQQOne")
                .build()
                .execute(callback);
    }

    //QQ验证第二次
    public static void verifyQQTwo(String access_token, String open_id, String phone, String appid, String user_id, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/platform/login/qq")
                .addParams("access_token", access_token)//Q
                .addParams("open_id", open_id)
                .addParams("phone", phone)
                .addParams("mode", "2")
                .addParams("appid", appid)//1:IOS 2:Android 3:Applets
                .addParams("user_id", user_id)
                .tag("verifyQQTwo")
                .build()
                .execute(callback);
    }

    //发送手机验证码
    public static void getCellPhoneCode(String phone, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/msg/send")
                .addParams("phone", phone)//手机号
                .tag("getCellPhoneCode")
                .build()
                .execute(callback);
    }

    //发送邮箱验证码
    public static void getEmailCode(String email, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/email/send")
                .addParams("email", email)//邮箱号
                .tag("getEmailCode")
                .build()
                .execute(callback);
    }

    //验证手机短信
    public static void verifyCellPhoneCode(String phone, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/msg/verify")
                .addParams("phone", phone)//手机号
                .addParams("code", code)//手机号验证
                .tag("verifyCellPhoneCode")
                .build()
                .execute(callback);
    }

    //验证QQ邮箱代码
    public static void verifyEmailCode(String email, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/email/verify")
                .addParams("email", email)//QQ邮箱
                .addParams("code", code)//手机号验证
                .tag("verifyEmailCode")
                .build()
                .execute(callback);
    }

    //验证QQ邮箱，手机登录代码
    public static void verifyLoginEmailCode(String phone, String type, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/login")
                .addParams("phone", phone)
                .addParams("type", type)//tel 手机 email 邮箱
                .addParams("code", code)
                .tag("verifyLoginEmailCode")
                .build()
                .execute(callback);
    }

    //    用户信息
    public static void getUserInfoByToken(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/user/info")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getUserInfoByToken")
                .build()
                .execute(callback);
    }


    //zixun搜索记录
    public static void getSearchHistoryData(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/news/search")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getSearchHistoryData")
                .build()
                .execute(callback);
    }

    //修改用户信息
    public static void saveUserInfo(String authorization, String nickName, String gender, String birthday, String zone_id, String city_id, String county_id, String signature, String avatar, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/info")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("nickName", nickName)
                .addParams("gender", gender)
                .addParams("birthday", birthday)
                .addParams("zone_id", zone_id)
                .addParams("city_id", city_id)
                .addParams("county_id", county_id)
                .addParams("signature", signature)
                .addParams("avatar", avatar)
                .tag("saveUserInfo")
                .build()
                .execute(callback);
    }

    //    资讯查看列表
    public static void getZiXunListData(String authorization, String title, String page, String limit, StringCallback callback) {
        if (BaseMethod.notNull(authorization)) {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/news")
                    .addHeader("Authorization", "Bearer " + authorization)
                    .addParams("title", title)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .tag("getZiXunListData")
                    .build()
                    .execute(callback);
        } else {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/news")
                    .addParams("title", title)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .tag("getZiXunListData")
                    .build()
                    .execute(callback);
        }
    }

    //    资讯详情
    public static void getZiXunDetails(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/news/info/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getZiXunDetails")
                .build()
                .execute(callback);
    }

    //删除收货地址
    public static void deleteGoodsAddress(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .delete()
                .url(Constants.MAIN_URL + "/v1/user/address/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("deleteGoodsAddress")
                .build()
                .execute(callback);
    }

    //联系我们
    public static void getContactUsData(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/contact")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getContactUsData")
                .build()
                .execute(callback);
    }

    //收货地址列表
    public static void getAddressList(String authorization, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/user/address")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getAddressList")
                .build()
                .execute(callback);
    }

    //新增收货地址
    public static void addGoosAddress(String authorization, String name, String telephone, String countyid, String cityid, String zoneid, String address, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/address")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("zoneid", zoneid)
                .addParams("cityid", cityid)
                .addParams("countyid", countyid)
                .addParams("name", name)
                .addParams("telephone", telephone)
                .addParams("address", address)
                .tag("addGoosAddress")
                .build()
                .execute(callback);
    }

    //修改收货地址
    public static void modifyGoosAddress(String authorization, String id, String name, String telephone, String countyid, String cityid, String zoneid, String address, StringCallback callback) {
        FormBody build = new FormBody.Builder()
                .add("zoneid", zoneid)
                .add("cityid", cityid)
                .add("countyid", countyid)
                .add("name", name)
                .add("telephone", telephone)
                .add("address", address)
                .build();
        OkHttpUtils
                .put()
                .url(Constants.MAIN_URL + "/v1/user/address/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .requestBody(build)
                .tag("modifyGoosAddress")
                .build()
                .execute(callback);
    }

    //退出
    public static void exitUserAccount(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/user/logout")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("exitUserAccount")
                .build()
                .execute(callback);
    }

    //切换角色
    public static void changeRole(String authorization, String role, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/role")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("role", role)
                .tag("changeRole")
                .build()
                .execute(callback);
    }

    //实名认证
    public static void realNameAuth(String authorization, String card_id, String name, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/faceid")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("card_id", card_id)
                .addParams("name", name)
                .tag("realNameAuth")
                .build()
                .execute(callback);
    }

    //店家认证
    public static void authDianjia(String authorization, String shop_id, String phone, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/customer")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "1")
                .addParams("shop_id", shop_id)
                .addParams("phone", phone)
                .tag("realNameAuth")
                .build()
                .execute(callback);
    }

    //店家认证2
    public static void authDianjiaTwo(String authorization, String shop_id, String phone, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/customer")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "2")
                .addParams("shop_id", shop_id)
                .addParams("phone", phone)
                .addParams("code", code)
                .tag("authDianjiaTwo")
                .build()
                .execute(callback);
    }

    //裁判认证
    public static void authJudge(String authorization, String invite_code, String phone, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/referee")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "1")
                .addParams("invite_code", invite_code)
                .addParams("phone", phone)
                .tag("authJudge")
                .build()
                .execute(callback);
    }

    //裁判认证2
    public static void authJudgeTwo(String authorization, String invite_code, String phone, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/referee")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "2")
                .addParams("invite_code", invite_code)
                .addParams("phone", phone)
                .addParams("code", code)
                .tag("authJudgeTwo")
                .build()
                .execute(callback);
    }

    //意见反馈
    public static void showSubmitFeedback(String authorization, String type, String content, String images, String tel, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/feedback")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .addParams("context", content)
                .addParams("images", images)
                .addParams("tel", tel)
                .tag("showSubmitFeedback")
                .build()
                .execute(callback);
    }

    //修改手机号
    public static void resetPhone(String authorization, String phone, String newPhone, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/reset/phone")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "1")
                .addParams("phone", phone)
                .addParams("newPhone", newPhone)
                .tag("resetPhone")
                .build()
                .execute(callback);
    }

    //修改手机号2
    public static void resetPhoneTwo(String authorization, String code, String newPhone, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/reset/phone")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "2")
                .addParams("code", code)
                .addParams("newPhone", newPhone)
                .tag("resetPhoneTwo")
                .build()
                .execute(callback);
    }

    //更换邮箱
    public static void bindEmail(String authorization, String code, String newEmail, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/reset/email")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("newEmail", newEmail)
                .addParams("code", code)
                .tag("bindEmail")
                .build()
                .execute(callback);
    }

    //赛事首页
    public static void getSaiShiHomeListData(String authorization, String type, String status, String page, String limit, String area_code, StringCallback callback) {
        if (BaseMethod.notNull(authorization)) {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/match")
                    .addHeader("Authorization", "Bearer " + authorization)
                    .addParams("type", type)//类型：0全部 1:娱乐赛2：积分赛3：特殊赛4：巡回赛
                    .addParams("status", status)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .addParams("area_code", area_code)
                    .tag("getSaiShiHomeListData")
                    .build()
                    .execute(callback);
        } else {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/match")
                    .addParams("type", type)//类型：0全部 1:娱乐赛2：积分赛3：特殊赛4：巡回赛
                    .addParams("status", status)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .addParams("area_code", area_code)
                    .tag("getSaiShiHomeListData")
                    .build()
                    .execute(callback);
        }
    }

    //赛事搜索
    public static void getSearchSaiShiList(String authorization, String keywords, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("keywords", keywords)
                .addParams("status", "108")
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getSearchSaiShiList")
                .build()
                .execute(callback);
    }

    //赛事首页详情
    public static void getDetailsSaiShiData(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/info/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getDetailsSaiShiData")
                .build()
                .execute(callback);
    }

    //商家申请比赛
    public static void shangjiaCreateGameOne(String authorization, String name, String contact, String start_at,
                                             String players, String cost, String type, String condition, String address,
                                             String address_position, String rule, String rounds, String winning,
                                             String zone_id, String cityid, String countyid, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/apply")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "1")
                .addParams("name", name)
                .addParams("contact", contact)
                .addParams("start_at", start_at)
                .addParams("players", players)
                .addParams("cost", cost)
                .addParams("type", type)
                .addParams("condition", condition)
                .addParams("zoneid", zone_id)
                .addParams("cityid", cityid)
                .addParams("countyid", countyid)
                .addParams("address", address)
                .addParams("address_position", address_position)
                .addParams("rule", rule)
                .addParams("rounds", rounds)
                .addParams("winning", winning)
                .tag("shangjiaCreateGameOne")
                .build()
                .execute(callback);
    }

    //商家申请比赛2
    public static void shangjiaCreateGameTwo(String authorization, String prize, String remarks, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/apply")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "2")
                .addParams("prize", prize)
                .addParams("remarks", remarks)
                .tag("shangjiaCreateGameTwo")
                .build()
                .execute(callback);
    }

    //商家申请比赛3
    public static void shangjiaCreateGameThree(String authorization, String bannerJson, String name, String contact, String start_at,
                                               String players, String cost, String type, String condition, String address,
                                               String address_position, String rule, String rounds, String winning,
                                               String zone_id, String cityid, String countyid, String prize, String remarks, StringCallback callback) {

        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/apply")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "3")
                .addParams("name", name)
                .addParams("contact", contact)
                .addParams("start_at", start_at)
                .addParams("players", players)
                .addParams("cost", cost)
                .addParams("type", type)
                .addParams("condition", condition)
                .addParams("zoneid", zone_id)
                .addParams("cityid", cityid)
                .addParams("countyid", countyid)
                .addParams("address", address)
                .addParams("address_position", address_position)
                .addParams("rule", rule)
                .addParams("rounds", rounds)
                .addParams("winning", winning)
                .addParams("prize", prize)
                .addParams("remarks", remarks)
                .addParams("banner", bannerJson)
                .tag("shangjiaCreateGameThree")
                .build()
                .execute(callback);
    }

    public static void shangjiaCreateGameThreeArray(String authorization, Map<String, String> params, String name, String contact, String start_at,
                                                    String players, String cost, String type, String condition, String address,
                                                    String address_position, String rule, String rounds, String winning,
                                                    String zone_id, String cityid, String countyid, String prize, String remarks, StringCallback callback) {

        OkHttpUtilsByArray
                .postArrayString(params)
                .url(Constants.MAIN_URL + "/v1/match/apply")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("steps", "3")
                .addParams("name", name)
                .addParams("contact", contact)
                .addParams("start_at", start_at)
                .addParams("players", players)
                .addParams("cost", cost)
                .addParams("type", type)
                .addParams("condition", condition)
                .addParams("zoneid", zone_id)
                .addParams("cityid", cityid)
                .addParams("countyid", countyid)
                .addParams("address", address)
                .addParams("address_position", address_position)
                .addParams("rule", rule)
                .addParams("rounds", rounds)
                .addParams("winning", winning)
                .addParams("prize", prize)
                .addParams("remarks", remarks)
                .tag("shangjiaCreateGameThreeArray")
                .build()
                .execute(callback);
    }

    //赛事申请报名
    public static void applaySaiShiGame(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/signup/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("applaySaiShiGame")
                .build()
                .execute(callback);
    }

    //店家开启比赛
    public static void dianjiaStartGame(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/start/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("dianjiaStartGame")
                .build()
                .execute(callback);
    }

    //审核裁判列表
    public static void getCaiPanListData(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/referee/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getCaiPanListData")
                .build()
                .execute(callback);
    }

    //审核裁判列表搜索
    public static void searchCaiPanListData(String authorization, String id, String keywords, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/referee/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("keywords", keywords)
                .tag("searchCaiPanListData")
                .build()
                .execute(callback);
    }

    //裁判申请裁判
    public static void caipanApplay(String authorization, String id, String type, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/referee/apply/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .tag("caipanApplay")
                .build()
                .execute(callback);
    }

    //商家申请主裁判
    public static void caipanDianjiaApplay(String authorization, String id, String type, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/referee/apply/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .addParams("status", "2")
                .tag("caipanDianjiaApplay")
                .build()
                .execute(callback);
    }

    //裁判取消裁判
    public static void caipanDelete(String authorization, String id, String remark, StringCallback callback) {
        JSONObject object = new JSONObject();
        try {
            object.put("remark", remark);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        //String转RequestBody String、ByteArray、ByteString都可以用toRequestBody()
        MediaType mediaType = MediaType.Companion.parse("application/json;charset=utf-8");
        RequestBody stringBody = RequestBody.Companion.create(object.toString(), mediaType);
        OkHttpUtils
                .delete()
                .url(Constants.MAIN_URL + "/v1/match/referee/apply/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .requestBody(stringBody)
                .tag("caipanDelete")
                .build()
                .execute(callback);
    }

    //删除历史记录
    public static void deleteNewsSearchHistory(String authorization, StringCallback callback) {
        OkHttpUtils
                .delete()
                .url(Constants.MAIN_URL + "/v1/news/search")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("deleteNewsSearchHistory")
                .build()
                .execute(callback);
    }

    //选手自己退出自己参赛比赛
    public static void exitGamePlayers(String authorization, String id, String remark, StringCallback callback) {
        JSONObject object = new JSONObject();
        try {
            object.put("remark", remark);
        } catch (JSONException e) {
            e.printStackTrace();
        }
        //String转RequestBody String、ByteArray、ByteString都可以用toRequestBody()
        MediaType mediaType = MediaType.Companion.parse("application/json;charset=utf-8");
        RequestBody stringBody = RequestBody.Companion.create(object.toString(), mediaType);
        OkHttpUtils
                .delete()
                .url(Constants.MAIN_URL + "/v1/match/signup/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .requestBody(stringBody)
                .tag("exitGamePlayers")
                .build()
                .execute(callback);
    }

    //店家退出裁判
    public static void dianjiaExitCaiPan(String authorization, String id, int uid, String remark, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/customer/referee/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("remark", remark)
                .addParams("uid", uid + "")
                .tag("dianjiaExitCaiPan")
                .build()
                .execute(callback);
    }

    //店家审核通过裁判
    public static void dianjiaPassCaiPan(String authorization, String id, int uid, String type, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/referee/verify/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("id", uid + "")
                .addParams("status", "2")
                .addParams("type", type)
                .tag("dianjiaPassCaiPan")
                .build()
                .execute(callback);
    }

    //我的消息
    public static void getMeMessage(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/user/message")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getMeMessage")
                .build()
                .execute(callback);
    }

    //消息通知
    public static void getMeMessageDetails(String authorization, String type, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/message")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .tag("getMeMessageDetails")
                .build()
                .execute(callback);
    }

    //比赛对阵信息
    public static void getDuiZHenGameDetails(String authorization, String id, String type, String round, String status_id, String search_id, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/against/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)//all: 所有对阵信息 self:只看自己
                .addParams("round", round)
                .addParams("status_id", status_id)
                .addParams("search_id", search_id)
                .tag("getDuiZHenGameDetails")
                .build()
                .execute(callback);
    }

    //主裁判修改成绩
    public static void mainRefereeEditorGrades(String authorization, String vid, String grade, String statusid, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/referee/grades/edit/" + vid)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("grade", grade)
                .addParams("statusid", statusid)
                .tag("mainRefereeEditorGrades")
                .build()
                .execute(callback);
    }

    //开启对阵信息
    public static void mainRefereeStartRuiShiLunGame(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/start/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("mainRefereeStartRuiShiLunGame")
                .build()
                .execute(callback);
    }

    //选手自己提交成绩
    public static void playsSubmitGrade(String authorization, String id, String grade, String statusid, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/grades/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("grade", grade)
                .addParams("statusid", statusid)
                .tag("playsSubmitGrade")
                .build()
                .execute(callback);
    }

    //判罚类型列表
    public static void getPanFaStyleList(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/penalty/type/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getPanFaStyleList")
                .build()
                .execute(callback);
    }

    //判罚列表
    public static void getPanFaList(String authorization, String id, String user_id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/penalty/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("user_id", user_id)
                .tag("getPanFaList")
                .build()
                .execute(callback);
    }

    //全部判罚列表
    public static void getAllPanFaList(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/penalty/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getAllPanFaList")
                .build()
                .execute(callback);
    }

    //判罚操作
    public static void panfaPlayers(String authorization, String vid, String user_id, String type_id, String remark, String statusid, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/referee/penalty/" + vid)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("user_id", user_id)
                .addParams("type_id", type_id)
                .addParams("remark", remark)
                .addParams("statusid", statusid)
                .tag("panfaPlayers")
                .build()
                .execute(callback);
    }

    //裁判列表
    public static void getCaiPanList(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/referee/list/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getCaiPanList")
                .build()
                .execute(callback);
    }

    //选手列表
    public static void getJoinPlayersList(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/players/list/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getJoinPlayersList")
                .build()
                .execute(callback);
    }

    //审核选手列表
    public static void getAuthPlayersList(String authorization, String id, String keywords, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/customer/player/list/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("keywords", keywords)
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getAuthPlayersList")
                .build()
                .execute(callback);
    }

    //商家退出选手
    public static void dianjiaExitPlayer(String authorization, String id, String uid, String remark, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/customer/signup/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("uid", uid)
                .addParams("remark", remark)
                .tag("dianjiaExitPlayer")
                .build()
                .execute(callback);
    }

    //裁判设置为主裁判
    public static void dianjiaMakeJudgeTop(String authorization, String id, String uid, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/customer/preferee/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("uid", uid)
                .tag("dianjiaMakeJudgeTop")
                .build()
                .execute(callback);
    }

    //审核选手成绩列表
    public static void getJudgeAuthPlayersList(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/referee/grades/verify/index/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getJudgeAuthPlayersList")
                .build()
                .execute(callback);
    }

    //确认成绩有效
    public static void judgeAuthValid(String authorization, String id, String statusid, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/referee/grades/confirm/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("statusid", statusid)
                .tag("judgeAuthValid")
                .build()
                .execute(callback);
    }

    //裁判修改成绩
    public static void judgeEditGrade(String authorization, String vid, String grade, String statusid, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/referee/grades/edit/" + vid)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("grade", grade)
                .addParams("statusid", statusid)
                .tag("judgeEditGrade")
                .build()
                .execute(callback);
    }

    //开启下一轮
    public static void startNextRound(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/nextround/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("startNextRound")
                .build()
                .execute(callback);
    }

    //生成赛果
    public static void produceSaShiReSult(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/result/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("produceSaShiReSult")
                .build()
                .execute(callback);
    }

    //生成淘汰赛对阵
    public static void generateEliminateSaShi(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/off/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("generateEliminateSaShi")
                .build()
                .execute(callback);
    }

    //查看赛果
    public static void reviewAgainstResult(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/resultview/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("reviewAgainstResult")
                .build()
                .execute(callback);
    }

    //查看比赛过程图片
    public static void getAgainstPhoto(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/photo/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getAgainstPhoto")
                .build()
                .execute(callback);
    }

    //提交比赛过程图片
    public static void submitAgainstPhoto(String authorization, String id, String live, String champion, String runnerup, String topfoura, String topfourb, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/against/photo/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("live", live)
                .addParams("champion", champion)
                .addParams("runnerup", runnerup)
                .addParams("topfoura", topfoura)
                .addParams("topfourb", topfourb)
                .tag("submitAgainstPhoto")
                .build()
                .execute(callback);
    }

    //修改比赛过程图片
    public static void modifyAgainstPhoto(String authorization, String id, String live, String champion, String runnerup, String topfoura, String topfourb, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/against/photo/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("id", "1")
                .addParams("live", live)
                .addParams("champion", champion)
                .addParams("runnerup", runnerup)
                .addParams("topfoura", topfoura)
                .addParams("topfourb", topfourb)
                .tag("modifyAgainstPhoto")
                .build()
                .execute(callback);
    }

    //娱乐赛跳过图片提交
    public static void submitPhotoJump(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/against/photoignore/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("submitPhotoJump")
                .build()
                .execute(callback);
    }

    //获取赛事状态角色
    public static void getGameStatusRole(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/state/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getGameStatusRole")
                .build()
                .execute(callback);
    }

    //瑞士轮排行
    public static void getRuiShiLunList(String authorization, String id, String round, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/match/against/swiss/rank/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("round", round)
                .tag("getRuiShiLunList")
                .build()
                .execute(callback);
    }

    //比赛记录(选手)
    public static void getXuanShouPlayerGameList(String authorization, String type, String status, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/personal/management/player")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .addParams("status", status)
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getXuanShouPlayerGameList")
                .build()
                .execute(callback);
    }

    //比赛记录(裁判)
    public static void getCaiPanGameList(String authorization, String type, String status, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/personal/management/referee")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .addParams("status", status)
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getCaiPanGameList")
                .build()
                .execute(callback);
    }

    //比赛记录(店家)
    public static void getDianJiaGameList(String authorization, String type, String status, String page, String limit, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/personal/management/customer")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("type", type)
                .addParams("status", status)
                .addParams("page", page)
                .addParams("limit", limit)
                .tag("getDianJiaGameList")
                .build()
                .execute(callback);
    }

    //积分排行榜
    public static void getRankingList(String authorization, String type, String season_id, String page, String limit, StringCallback callback) {
        if (BaseMethod.notNull(authorization)) {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/points/ranking")
                    .addHeader("Authorization", "Bearer " + authorization)
                    .addParams("type", type)
                    .addParams("season_id", season_id)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .tag("getRankingList")
                    .build()
                    .execute(callback);
        } else {
            OkHttpUtils
                    .post()
                    .url(Constants.MAIN_URL + "/v1/points/ranking")
                    .addParams("type", type)
                    .addParams("season_id", season_id)
                    .addParams("page", page)
                    .addParams("limit", limit)
                    .tag("getRankingList")
                    .build()
                    .execute(callback);
        }
    }

    //个人中心各个角色下的赛事统计信息
    public static void getUserGameList(String authorization, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/personal/center")
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("getUserGameList")
                .build()
                .execute(callback);
    }

    //赛事预约
    public static void saishiYuYue(String authorization, String id, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/match/reserve/" + id)
                .addHeader("Authorization", "Bearer " + authorization)
                .tag("saishiYuYue")
                .build()
                .execute(callback);
    }

    //条例文档等
    public static void guiZeHtml(String type, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/directions")
                .addParams("type", type)
                .tag("guiZeHtml")
                .build()
                .execute(callback);
    }

    //三方解绑
    public static void unBiind(String authorization, String name, StringCallback callback) {
        OkHttpUtils
                .get()
                .url(Constants.MAIN_URL + "/v1/user/platform/relieve/" + name)
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("name", name)
                .tag("unBiind")
                .build()
                .execute(callback);
    }

    //绑定qq
    public static void bindQQ(String authorization, String open_id, String access_token, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/platform/relation/qq")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("open_id", open_id)
                .addParams("appid", "2")
                .addParams("access_token", access_token)
                .tag("bindQQ")
                .build()
                .execute(callback);
    }

    //绑定wx
    public static void bindWX(String authorization, String code, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/user/platform/relation/wx")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("code", code)
                .addParams("appid", "2")
                .tag("bindWX")
                .build()
                .execute(callback);
    }

    //奖励领取
    public static void receiveReward(String authorization, String address_id, StringCallback callback) {
        OkHttpUtils
                .post()
                .url(Constants.MAIN_URL + "/v1/points/receive")
                .addHeader("Authorization", "Bearer " + authorization)
                .addParams("address_id", address_id)
                .tag("receiveReward")
                .build()
                .execute(callback);
    }
}

